"""
应用配置文件
"""
import os
from typing import List
try:
    from pydantic_settings import BaseSettings
except ImportError:
    from pydantic import BaseSettings

class Settings(BaseSettings):
    """应用配置"""
    
    # API配置
    API_V1_STR: str = "/api/v1"
    PROJECT_NAME: str = "Kafka Monitor"
    VERSION: str = "1.0.0"
    
    # 服务器配置
    HOST: str = "0.0.0.0"
    PORT: int = 8000
    
    # CORS配置
    CORS_ORIGINS: List[str] = ["http://localhost:3000", "http://127.0.0.1:3000"]
    
    # 日志配置
    LOG_LEVEL: str = "INFO"
    
    # Kafka默认配置
    DEFAULT_BOOTSTRAP_SERVERS: str = "localhost:9092"
    DEFAULT_SECURITY_PROTOCOL: str = "PLAINTEXT"
    DEFAULT_SASL_MECHANISM: str = "PLAIN"
    
    # WebSocket配置
    WS_HEARTBEAT_INTERVAL: int = 30
    
    class Config:
        env_file = ".env"
        case_sensitive = True

# 全局配置实例
settings = Settings() 